using UnityEngine;
using UnityEngine.UI;

public class StartRectTransform
{
	private Vector3 localPosition;

	private Quaternion localRotation;

	private Vector3 localScale;

	private RectTransform transform;

	private Vector2 screenSize;

	private float randomScale;

	public StartRectTransform(RectTransform transform)
	{
		this.transform = transform;
		localPosition = transform.localPosition;
		localRotation = Quaternion.Euler(0f, 0f, 0f);
		localScale = transform.localScale;
		randomScale = 0f;
		screenSize = transform.GetComponentInParent<CanvasScaler>().referenceResolution;
		screenSize.x /= 3f;
		screenSize.y /= 4f;
	}

	public void Reset()
	{
		transform.localPosition = localPosition;
		transform.localRotation = localRotation;
		transform.localScale = localScale;
	}

	public void DisposeText()
	{
		if (transform.gameObject.activeSelf)
		{
			transform.localRotation = Quaternion.Euler(0f, 0f, Random.Range(-6, 6) * 10);
			transform.localPosition = new Vector3(Random.Range(0f - screenSize.x, screenSize.x), Random.Range(0f - screenSize.y, screenSize.y), localPosition.z);
			randomScale = Random.value;
			transform.localScale = new Vector3(Mathf.Lerp(0.4f, 1.5f, randomScale), Mathf.Lerp(4f, 0.5f, randomScale), 1f);
		}
	}
}
